<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#375EAB">

  <title>readini - Go Documentation Server</title>

<link type="text/css" rel="stylesheet" href="readini%20-%20Go%20Documentation%20Server_files/style.css">

<script>window.initFuncs = [];</script>
<script src="readini%20-%20Go%20Documentation%20Server_files/jquery.js" defer="defer"></script>



<script>var goVersion = "go1.15.2";</script>
<script src="readini%20-%20Go%20Documentation%20Server_files/godocs.js" defer="defer"></script>
</head>
<body>

<div id="lowframe" style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;">
...
</div><!-- #lowframe -->

<div id="topbar" class="wide"><div class="container">
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/pkg/">Go Documentation Server</a></div>
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/pkg/">GoDoc</a></div>
<a href="#" id="menu-button"><span id="menu-button-arrow">▽</span></a>
<form method="GET" action="/search">
<div id="menu" style="min-width: 60px;">

<span class="search-box"><input type="search" id="search" name="q" placeholder="Search" aria-label="Search" required=""><button type="submit"><span><!-- magnifying glass: --><svg width="24" height="24" viewBox="0 0 24 24"><title>submit search</title><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path><path d="M0 0h24v24H0z" fill="none"></path></svg></span></button></span>
</div>
</form>

</div></div>



<div id="page" class="wide" style="outline: currentcolor none 0px;" tabindex="-1">
<div class="container">


  <h1>
    Package readini
    <span class="text-muted"></span>
  </h1>







<div id="nav"></div>


<!--
	Copyright 2009 The Go Authors. All rights reserved.
	Use of this source code is governed by a BSD-style
	license that can be found in the LICENSE file.
-->
<!--
	Note: Static (i.e., not template-generated) href and id
	attributes start with "pkg-" to make it impossible for
	them to conflict with generated attributes (some of which
	correspond to Go identifiers).
-->

	<script>
	document.ANALYSIS_DATA = null;
	document.CALLGRAPH = null;
	</script>

	
		
		<div id="short-nav">
			<dl>
			<dd><code>import "github.com/github-user/readini"</code></dd>
			</dl>
			<dl>
			<dd><a href="#pkg-overview" class="overviewLink">Overview</a></dd>
			<dd><a href="#pkg-index" class="indexLink">Index</a></dd>
			
			
			</dl>
		</div>
		<!-- The package's Name is printed as title by the top-level template -->
		<div id="pkg-overview" class="toggleVisible">
			<div class="collapsed">
				<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2>
			</div>
			<div class="expanded">
				<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2>
				<p>
Package readini 用于读取和监听 ini 配置文件
</p>

				
			</div>
		</div>

		<div id="pkg-index" class="toggleVisible">
		<div class="collapsed">
			<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2>
		</div>
		<div class="expanded">
			<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2>

		<!-- Table of contents for API; must be named manual-nav to turn off auto nav. -->
			<div id="manual-nav">
			<dl>
			
				<dd><a href="#pkg-constants">Constants</a></dd>
			
			
				<dd><a href="#pkg-variables">Variables</a></dd>
			
			
			
				
				<dd><a href="#Configuration">type Configuration</a></dd>
				
					
					<dd>&nbsp; &nbsp; <a href="#Load">func Load(filename string) (*Configuration, error)</a></dd>
				
					
					<dd>&nbsp; &nbsp; <a href="#Watch">func Watch(filename string, listener Listener) (*Configuration, error)</a></dd>
				
				
					
					<dd>&nbsp; &nbsp; <a href="#Configuration.GetSection">func (cfg *Configuration) GetSection(secName string) (*Section, error)</a></dd>
				
					
					<dd>&nbsp; &nbsp; <a href="#Configuration.GetSectionList">func (cfg *Configuration) GetSectionList() []string</a></dd>
				
			
				
				<dd><a href="#ListenFunc">type ListenFunc</a></dd>
				
				
			
				
				<dd><a href="#Listener">type Listener</a></dd>
				
				
			
				
				<dd><a href="#Section">type Section</a></dd>
				
				
					
					<dd>&nbsp; &nbsp; <a href="#Section.GetKey">func (sec *Section) GetKey(keyName string) (string, error)</a></dd>
				
					
					<dd>&nbsp; &nbsp; <a href="#Section.GetKeyList">func (sec *Section) GetKeyList() []string</a></dd>
				
			
			
			</dl>
			</div><!-- #manual-nav -->

		

		
			<h3>Package files</h3>
			<p>
			<span style="font-size:90%">
			
				<a href="http://localhost:6060/src/github.com/github-user/readini/configuration.go">configuration.go</a>
			
				<a href="http://localhost:6060/src/github.com/github-user/readini/parse.go">parse.go</a>
			
				<a href="http://localhost:6060/src/github.com/github-user/readini/section.go">section.go</a>
			
				<a href="http://localhost:6060/src/github.com/github-user/readini/watch.go">watch.go</a>
			
			</span>
			</p>
		
		</div><!-- .expanded -->
		</div><!-- #pkg-index -->

		

		
			<h2 id="pkg-constants">Constants <a class="permalink" href="#pkg-constants">¶</a></h2>
			
				
				<pre>const (
    <span class="comment">// DefaultSection 是默认 section 的名称.</span>
    <span class="comment">// 在大多数情况下，访问该 section 只需使用空字符串"".</span>
    <span id="DefaultSection">DefaultSection</span> = "DEFAULT"

    <span class="comment">// KeyValueDelimiter 是用于分隔 key 和 value 的分隔符.</span>
    <span id="KeyValueDelimiter">KeyValueDelimiter</span> = "="
)</pre>
			
		
		
			<h2 id="pkg-variables">Variables <a class="permalink" href="#pkg-variables">¶</a></h2>
			
				
				<pre>var (
    <span class="comment">// CommentSymbol 表明注释开始.</span>
    <span class="comment">// 在 Windows 系统中, 初始化时该变量会自动变为";".</span>
    <span id="CommentSymbol">CommentSymbol</span> = "#"

    <span class="comment">// LineBreak 表明新行开始.</span>
    <span class="comment">// 在 Windows 系统中, 初始化时该变量会自动变为"\r\n".</span>
    <span id="LineBreak">LineBreak</span> = "\n"
)</pre>
			
		
		
		
			
			
			<h2 id="Configuration">type <a href="http://localhost:6060/src/github.com/github-user/readini/configuration.go?s=123:289#L1">Configuration</a>
				<a class="permalink" href="#Configuration">¶</a>
				
				
			</h2>
			<p>
Configuration 存储该配置文件内所有分区 section.
</p>

			<pre>type Configuration struct {
    <span class="comment">// 存储分区名 section name.</span>
<span id="Configuration.SectionList"></span>    SectionList []<a href="http://localhost:6060/pkg/builtin/#string">string</a>
    <span class="comment">// section name 和 section 之间的映射.</span>
<span id="Configuration.Sections"></span>    Sections map[<a href="http://localhost:6060/pkg/builtin/#string">string</a>]*<a href="#Section">Section</a>
}
</pre>

			

			

			
			
			

			
				
				<h3 id="Load">func <a href="http://localhost:6060/src/github.com/github-user/readini/configuration.go?s=1501:1551#L50">Load</a>
					<a class="permalink" href="#Load">¶</a>
					
					
				</h3>
				<pre>func Load(filename <a href="http://localhost:6060/pkg/builtin/#string">string</a>) (*<a href="#Configuration">Configuration</a>, <a href="http://localhost:6060/pkg/builtin/#error">error</a>)</pre>
				<p>
Load 读取 ini 配置文件.
</p>

				
				
			
				
				<h3 id="Watch">func <a href="http://localhost:6060/src/github.com/github-user/readini/watch.go?s=409:479#L7">Watch</a>
					<a class="permalink" href="#Watch">¶</a>
					
					
				</h3>
				<pre>func Watch(filename <a href="http://localhost:6060/pkg/builtin/#string">string</a>, listener <a href="#Listener">Listener</a>) (*<a href="#Configuration">Configuration</a>, <a href="http://localhost:6060/pkg/builtin/#error">error</a>)</pre>
				<p>
Watch 读取 ini 配置文件并监听配置变化.
</p>

				
				
			

			
				
				<h3 id="Configuration.GetSection">func (*Configuration) <a href="http://localhost:6060/src/github.com/github-user/readini/configuration.go?s=885:955#L29">GetSection</a>
					<a class="permalink" href="#Configuration.GetSection">¶</a>
					
					
				</h3>
				<pre>func (cfg *<a href="#Configuration">Configuration</a>) GetSection(secName <a href="http://localhost:6060/pkg/builtin/#string">string</a>) (*<a href="#Section">Section</a>, <a href="http://localhost:6060/pkg/builtin/#error">error</a>)</pre>
				<p>
GetSection returns 根据分区名 section name 返回对应的分区 section.
</p>

				
				
				
			
				
				<h3 id="Configuration.GetSectionList">func (*Configuration) <a href="http://localhost:6060/src/github.com/github-user/readini/configuration.go?s=1254:1305#L41">GetSectionList</a>
					<a class="permalink" href="#Configuration.GetSectionList">¶</a>
					
					
				</h3>
				<pre>func (cfg *<a href="#Configuration">Configuration</a>) GetSectionList() []<a href="http://localhost:6060/pkg/builtin/#string">string</a></pre>
				<p>
GetSectionList returns 返回该配置文件中所有分区名 section name 组成的列表.
</p>

				
				
				
			
		
			
			
			<h2 id="ListenFunc">type <a href="http://localhost:6060/src/github.com/github-user/readini/watch.go?s=123:151#L1">ListenFunc</a>
				<a class="permalink" href="#ListenFunc">¶</a>
				
				
			</h2>
			<p>
ListenFunc 用于监听 ini 配置文件.
</p>

			<pre>type ListenFunc func(<a href="http://localhost:6060/pkg/builtin/#string">string</a>)</pre>

			

			

			
			
			

			

			
		
			
			
			<h2 id="Listener">type <a href="http://localhost:6060/src/github.com/github-user/readini/watch.go?s=212:265#L1">Listener</a>
				<a class="permalink" href="#Listener">¶</a>
				
				
			</h2>
			<p>
Listener 是函数 listen(inifile string) 的接口.
</p>

			<pre>type Listener interface {
    <span class="comment">// contains filtered or unexported methods</span>
}</pre>

			

			

			
			
			

			

			
		
			
			
			<h2 id="Section">type <a href="http://localhost:6060/src/github.com/github-user/readini/section.go?s=92:215#L1">Section</a>
				<a class="permalink" href="#Section">¶</a>
				
				
			</h2>
			<p>
Section 存储该分区内所有键值对 key-value.
</p>

			<pre>type Section struct {
    <span class="comment">// 存储 key.</span>
<span id="Section.KeyList"></span>    KeyList []<a href="http://localhost:6060/pkg/builtin/#string">string</a>
    <span class="comment">// key 和 value 之间的映射.</span>
<span id="Section.KeyVal"></span>    KeyVal map[<a href="http://localhost:6060/pkg/builtin/#string">string</a>]<a href="http://localhost:6060/pkg/builtin/#string">string</a>
}
</pre>

			

			

			
			
			

			

			
				
				<h3 id="Section.GetKey">func (*Section) <a href="http://localhost:6060/src/github.com/github-user/readini/section.go?s=571:629#L14">GetKey</a>
					<a class="permalink" href="#Section.GetKey">¶</a>
					
					
				</h3>
				<pre>func (sec *<a href="#Section">Section</a>) GetKey(keyName <a href="http://localhost:6060/pkg/builtin/#string">string</a>) (<a href="http://localhost:6060/pkg/builtin/#string">string</a>, <a href="http://localhost:6060/pkg/builtin/#error">error</a>)</pre>
				<p>
GetKey  根据 key 返回对应的 value.
</p>

				
				
				
			
				
				<h3 id="Section.GetKeyList">func (*Section) <a href="http://localhost:6060/src/github.com/github-user/readini/section.go?s=838:879#L22">GetKeyList</a>
					<a class="permalink" href="#Section.GetKeyList">¶</a>
					
					
				</h3>
				<pre>func (sec *<a href="#Section">Section</a>) GetKeyList() []<a href="http://localhost:6060/pkg/builtin/#string">string</a></pre>
				<p>
GetKeyList 返回该分区中所有 key 组成的列表.
</p>

				
				
				
			
		
	

	







<div id="footer">
Build version go1.15.2.<br>
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>,
the content of this page is licensed under the
Creative Commons Attribution 3.0 License,
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br>
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> |
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a>
</div>

</div><!-- .container -->
</div><!-- #page -->


</body></html>